//
//  GGZFBTabBarViewController.m
//  Gunterapple
//
//  Created by 热带雨林 on 2020/4/1.
//  Copyright © 2020 热带雨林. All rights reserved.
//

#import "GGZFBTabBarViewController.h"
#import "GGZFBNavigationViewController.h"
#import "GGZFBHomeViewController.h"
#import "GGZFBBusinessViewController.h"
#import "GGZFBFriendsViewController.h"
#import "GGZFBMineViewController.h"

@interface GGZFBTabBarViewController ()

@end

@implementation GGZFBTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIViewController *homeVC = [self controlWithClassName:@"GGZFBHomeViewController" withTitle:@"首页" withImageName:@"TabBar_HomeBar"];
    UIViewController *businessVC = [self controlWithClassName:@"GGZFBBusinessViewController" withTitle:@"商圈" withImageName:@"TabBar_Businesses"];
    UIViewController *friendsVC = [self controlWithClassName:@"GGZFBFriendsViewController" withTitle:@"朋友圈" withImageName:@"TabBar_Friends"];
    UIViewController *mineVC = [self controlWithClassName:@"GGZFBMineViewController" withTitle:@"我的" withImageName:@"TabBar_Assets"];
    
    self.viewControllers = @[homeVC,businessVC,friendsVC,mineVC];
}
#pragma mark - 生成子控制
- (UIViewController *)controlWithClassName:(NSString *)className withTitle:(NSString *)title withImageName:(NSString *)imageName{
    //根据Str实例化
    Class cla = NSClassFromString(className);
    UIViewController *VC = [[cla alloc]init];
    VC.tabBarItem.title = title;
    VC.tabBarItem.image = [UIImage imageNamed:imageName];
    VC.tabBarItem.selectedImage = [UIImage imageNamed:[NSString stringWithFormat:@"%@_Sel",imageName]];
    GGZFBNavigationViewController *navigationVC = [[GGZFBNavigationViewController alloc]initWithRootViewController:VC];
    return navigationVC;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
